package com.tbit.main.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.tbit.main.dao.stat.MachineUsageSumStatDao;
import com.tbit.main.pojo.MachineUsageSumStat;
import com.tbit.main.service.MachineUsageSumStatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @author yao
 * @since 2025/2/10 14:45
 */
@Service
public class MachineUsageSumStatServiceImpl implements MachineUsageSumStatService {

    @Resource
    private MachineUsageSumStatDao machineUsageSumStatDao;

    @Override
    public List<MachineUsageSumStat> getList(Integer accountId, Integer machineId) {
        return machineUsageSumStatDao.selectList(accountId, Collections.singletonList(machineId));
    }

    @Override
    public List<MachineUsageSumStat> getListByMachineIds(Integer accountId, List<Integer> machineIds) {
        return CollUtil.isNotEmpty(machineIds)
                ? machineUsageSumStatDao.selectList(accountId, machineIds)
                : Collections.emptyList();
    }
}
